package com.xpm.base;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewbinding.ViewBinding;

public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActivity {
    protected VB binding;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = getBinding();
        setContentView(binding.getRoot());
        initView();
        initData();
        initListener();
    }



     protected void onDestroy() {
        super.onDestroy();
        binding = null;
    }



    // 抽象方法，子类需实现具体Binding类的初始化
    protected abstract VB getBinding();

    protected abstract void initView();
    protected abstract void initData();
    protected abstract void initListener();

}
